<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>门户大开型对象</title>
</head>
<body>
    <script>
        var Book = function(isbn, title, author) {
            if (!this.checkIsbn(isbn)) {
                throw new Error('Book constructor requires an isbn.');
            }
            this.isbn = isbn;
            this.title = title || 'No title specified';
            this.author = author || 'No author specified'; 
        };
        Book.prototype = {
            checkIsbn: function(isbn) {
                if (isbn == undefined || typeof isbn != 'string') {
                    return false;
                } else {
                    return true;
                }
            }
        }

        var theHobbit = new Book('0-395-07122-4', 'The Hobbit', 'J. R. R. Tolkien');
    </script>
</body>
</html>